//
//  HistoryViewCell.m
//  有材网
//
//  Created by qijia on 16/1/21.
//  Copyright © 2016年 肖扬. All rights reserved.
//

#import "HistoryViewCell.h"

@implementation HistoryViewCell

//- (void)awakeFromNib
//{
//    [super awakeFromNib];
//    
//    // Fix the bug in iOS7 - initial constraints warning
//    self.contentView.bounds = [UIScreen mainScreen].bounds;
//}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self ){
        self.titleLbl = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, kWIDTH-15, CGRectGetHeight(self.contentView.frame))];
        self.titleLbl.textColor = [UIColor blackColor];
        self.titleLbl.backgroundColor = [UIColor clearColor];
        self.titleLbl.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:self.titleLbl];
        
        self.lineImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, self.titleLbl.bottom-0.5, kWIDTH-15, 0.5)];
        self.lineImageView.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:self.lineImageView];
    }
    return self;
}

-(void)LoadViewFromObject:(NSString *)obj{
    self.titleLbl.text = obj;
}

- (CGSize)sizeThatFits:(CGSize)size
{
    CGFloat totalHeight = 0;
    totalHeight += [self.titleLbl sizeThatFits:size].height;
    totalHeight += 26; // margins
    return CGSizeMake(size.width, totalHeight);
}

@end
